package com.platform.enums;

import com.platform.comm.constants.EnumOption;
import com.platform.comm.enums.IDictEntry;
import com.platform.comm.enums.IEnumItem;
import com.platform.comm.enums.IEnumOption;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zq
 * @version 1.0
 * @date 2022/1/13 17:50
 */
@EnumOption(name = "itemDateFunction")
public enum ItemDateFunction implements IDictEntry, IEnumItem, IEnumOption<String> {
    /**
     * 条件
     */
    EQ("=", "等于"),
    LE("LE", "结束于"),
    GE("GE", "开始于");

    ItemDateFunction(String operation, String title) {
        this.operation = operation;
        this.title = title;
    }
    public final String operation;
    public final String title;

    public String getName() {
        return operation;
    }

    public String getDesc() {
        return title;
    }

    @Override
    public String key() {
        return name();
    }

    @Override
    public String value() {
        return title;
    }

    @Override
    public Map<String, String> enums() {
        return Arrays.stream(values()).collect(Collectors.toMap(IEnumOption::key, IEnumOption::value));
    }

    @Override
    public String getKey() {
        return operation;
    }

    @Override
    public String getValue() {
        return title;
    }

    @Override
    public Object getData() {
        return this;
    }

    @Override
    public boolean is(String code) {
        return false;
    }
}
